from django.http import JsonResponse
from rest_framework.views import APIView
# from rest_framework.response import Response
from main.utils.util_response import DetailResponse
from main.utils.util_json import get_json_from_file

# Create your views here.
tokens = get_json_from_file('data/tokens.json')

class LoginView(APIView):
    authentication_classes=[]
    
    def get(self, request):
        return DetailResponse(msg="请登录")
    def post(self, request):
        username = request.data.get('username')
        password = request.data.get('password')
        # print(username, password)
        return DetailResponse(data=tokens[username])

class LogoutView(APIView):
    def post(self, request):
        return DetailResponse()
    




